<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%     
	String path = request.getContextPath();     
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";     
%>  
<head>
	<title>开睿协同工作系统</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<base href="<%=basePath%>"/>   
	<link href="js/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
	<script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
	<script src="js/jquery.form.js" type="text/javascript"></script>
	<script src="js/ligerUI/ligerui.min.js" type="text/javascript"></script> 
	<style type="text/css">
		html,body,p,form,input,label,div,img,iframe {margin:0; padding:0;}
		body {font-family: 宋体, Simsun;}
		#loginForm {margin:15px 20px;}
		#loginForm label{margin-right:10px; vertical-align: middle;}
		#loginForm p{margin-bottom: 10px; font-size: 12px; line-height: 32px;}
		.input{padding: 0 6px; margin-right:6px; height: 24px; width:240px; vertical-align: middle; }
		.button{font-size: 14px; width: 97px; height: 34px; line-height: 30px; margin-left: 63px; }
	</style>
	<script type="text/javascript">
        var href = location.href;
        var parentHref = parent.location.href;
        if(parentHref != href && href.indexOf("login.do") != -1) parent.location.href = "login.do";
	
		$(document).ready(function () {
			$.ajaxSetup ({ cache:false, async:false});
			
		 	$.ligerDialog.open({ width:400, allowClose:false, title:'账号登录', target:$("#target1") });
		 	
		 	$("#vericode-btn").click(function(){
		 		$('#vericode-img').attr('src', 'vericode.do?' + Math.random());
		 	});

            var options = {dataType: 'json', success : process};
		 	$("#loginForm").submit(function(){
                $(this).ajaxSubmit(options);
                return false;
		 	});

            $('#vericode-img').attr('src', 'vericode.do?' + Math.random());
		 	$("#p_error").hide();
		 	$("#username").focus();
		 });

		 function process(responseJson) {
            if(responseJson.code == 0) {
                $('#error_label').text("错误信息：" + responseJson.message);
                $("#p_error").show();
                $("#vericode_text").attr('value', '');
				$("#vericode-btn").click();                
                return;
            }

            location.href = "index.do";
		 }
	</script>
</head>

<body style="padding:10px;">
	<div id="target1" style="margin:3px; display:none;">
	<form id="loginForm" method="post" action="login.do">
		<div>
			<p id = "p_error">
				<label id="error_label" for="error_text" style="color:red;">错&nbsp;&nbsp;&nbsp;&nbsp;误：${error}</label>
			</p>
			<p>
				<label id="account_label" for="username">账&nbsp;&nbsp;&nbsp;&nbsp;号</label>
				<input type="text" id="username" name="username" class="input" value="${username}"/>
			</p>
			<p>
				<label id="pass_label" for="password">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
				<input type="password" id="password" name="password" class="input" value="${password}"/>
			</p>
			<p>
				<label id="vericode_label" for="vericode_text">验&nbsp;证&nbsp;码</label>
				<input type="text" id="vericode_text" name="vericode" class="input" style="width:100px;"/>
				<img id="vericode-img" src="" height="26px" style="vertical-align:middle; margin-right: 6px;" />
				<input id="vericode-btn" type="button" value="刷新" style="height: 26px; width:55px;" />
			</p>
			<p>
				<input type="submit" value="登录" class="button"/>
			</p>
		</div>		
	</form>
	</div>
 <div style="display:none;">     
</div>
</body>
</html>
    